package com.ruoyi.asset.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.asset.mapper.AstDeviceRecordMapper;
import com.ruoyi.asset.domain.AstDeviceRecord;
import com.ruoyi.asset.service.IAstDeviceRecordService;
import com.ruoyi.common.core.text.Convert;

/**
 * 设备操作记录Service业务层处理
 * 
 * @author xunzhe
 * @date 2024-06-12
 */
@Service
public class AstDeviceRecordServiceImpl implements IAstDeviceRecordService 
{
    @Autowired
    private AstDeviceRecordMapper astDeviceRecordMapper;

    /**
     * 查询设备操作记录
     * 
     * @param recordId 设备操作记录主键
     * @return 设备操作记录
     */
    @Override
    public AstDeviceRecord selectAstDeviceRecordByRecordId(Long recordId)
    {
        return astDeviceRecordMapper.selectAstDeviceRecordByRecordId(recordId);
    }

    /**
     * 查询设备操作记录列表
     * 
     * @param astDeviceRecord 设备操作记录
     * @return 设备操作记录
     */
    @Override
    public List<AstDeviceRecord> selectAstDeviceRecordList(AstDeviceRecord astDeviceRecord)
    {
        return astDeviceRecordMapper.selectAstDeviceRecordList(astDeviceRecord);
    }

    /**
     * 新增设备操作记录
     * 
     * @param astDeviceRecord 设备操作记录
     * @return 结果
     */
    @Override
    public int insertAstDeviceRecord(AstDeviceRecord astDeviceRecord)
    {
        astDeviceRecord.setCreateTime(DateUtils.getNowDate());
        return astDeviceRecordMapper.insertAstDeviceRecord(astDeviceRecord);
    }

    /**
     * 修改设备操作记录
     * 
     * @param astDeviceRecord 设备操作记录
     * @return 结果
     */
    @Override
    public int updateAstDeviceRecord(AstDeviceRecord astDeviceRecord)
    {
        return astDeviceRecordMapper.updateAstDeviceRecord(astDeviceRecord);
    }

    /**
     * 批量删除设备操作记录
     * 
     * @param recordIds 需要删除的设备操作记录主键
     * @return 结果
     */
    @Override
    public int deleteAstDeviceRecordByRecordIds(String recordIds)
    {
        return astDeviceRecordMapper.deleteAstDeviceRecordByRecordIds(Convert.toStrArray(recordIds));
    }

    /**
     * 删除设备操作记录信息
     * 
     * @param recordId 设备操作记录主键
     * @return 结果
     */
    @Override
    public int deleteAstDeviceRecordByRecordId(Long recordId)
    {
        return astDeviceRecordMapper.deleteAstDeviceRecordByRecordId(recordId);
    }

    public int updateHandleStatus(Long deviceId,Long userId){
        return astDeviceRecordMapper.updateHandleStatus(deviceId,userId);
    }

    public List<AstDeviceRecord> selectMyCarryDevice(Long userId){
        return astDeviceRecordMapper.selectMyCarryDevice(userId);
    }

    public List<AstDeviceRecord> selectAstDeviceRecordListById(Long deviceId){
        return astDeviceRecordMapper.selectAstDeviceRecordListById(deviceId);
    }

    public List<AstDeviceRecord> selectAstDeviceRecordListByUserId(Long userId){
        return astDeviceRecordMapper.selectAstDeviceRecordListByUserId(userId);
    }

}
